package com.bf.electroplating.controller.front;

import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.enterprise.*;
import com.bf.electroplating.pojo.vo.sewageWarningConfig.SewageWarningVO;
import com.bf.electroplating.service.IFrontEnterpriseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 前端企业级环保管理驾驶舱数据控制器
 * 提供环保管理驾驶舱各个模块的数据接口
 */
@RestController
@RequestMapping("/api/front/enterprise")
@Tag(name = "前端企业级环保管理驾驶舱", description = "前端企业级环保管理驾驶舱相关接口")
public class FrontEnterpriseController {

    @Autowired
    private IFrontEnterpriseService frontEnterpriseService;

    /**
     * 1. 雨水排放口监控数据
     * 提供雨水排放口的监控数据，包括闸阀状态、PH值、电导率等
     */
    @GetMapping("/rainwater-monitoring")
    @Operation(summary = "获取雨水排放口监控数据")
    public ResultVO<RainwaterMonitoringDataVO> getRainwaterMonitoringData() {
        RainwaterMonitoringDataVO data = frontEnterpriseService.getRainwaterMonitoringData();
        return ResultVO.ok(data);
    }

    /**
     * 2. 用电管理数据
     * 提供环保和生产设备的用电监控数据
     */
    @GetMapping("/power-management")
    @Operation(summary = "获取用电管理数据")
    public ResultVO<PowerManagementDataVO> getPowerManagementData() {
        PowerManagementDataVO data = frontEnterpriseService.getPowerManagementData();
        return ResultVO.ok(data);
    }

    /**
     * 3. 应急物资库数据
     * 提供应急物资库存管理数据
     */
    @GetMapping("/emergency-supplies")
    @Operation(summary = "获取应急物资库数据")
    public ResultVO<EmergencySuppliesDataVO> getEmergencySuppliesData() {
        EmergencySuppliesDataVO data = frontEnterpriseService.getEmergencySuppliesData();
        return ResultVO.ok(data);
    }

    /**
     * 4. 设备数量统计
     * 提供总设备数、在线设备数、离线设备数统计
     */
    @GetMapping("/equipment-statistics")
    @Operation(summary = "获取设备数量统计数据")
    public ResultVO<EquipmentStatisticsDataVO> getEquipmentStatistics() {
        EquipmentStatisticsDataVO data = frontEnterpriseService.getEquipmentStatistics();
        return ResultVO.ok(data);
    }

    /**
     * 5. 预警处置数据
     * 提供预警总数、已处置、未处置统计及详细列表
     */
    @GetMapping("/alarm-handling")
    @Operation(summary = "获取预警处置数据")
    public ResultVO<AlarmHandlingDataVO> getAlarmHandlingData() {
        AlarmHandlingDataVO data = frontEnterpriseService.getAlarmHandlingData();
        return ResultVO.ok(data);
    }

    /**
     * 6. 废气处理设施数据
     * 提供PH值和ORP数据趋势
     */
    @GetMapping("/waste-gas-treatment")
    @Operation(summary = "获取废气处理设施数据")
    public ResultVO<WasteGasTreatmentDataVO> getWasteGasTreatmentData() {
        WasteGasTreatmentDataVO data = frontEnterpriseService.getWasteGasTreatmentData();
        return ResultVO.ok(data);
    }

    /**
     * 7. 危险废物管理数据
     * 提供产生量和处置量统计
     */
    @GetMapping("/hazardous-waste-management")
    @Operation(summary = "获取危险废物管理数据")
    public ResultVO<HazardousWasteManagementDataVO> getHazardousWasteManagementData() {
        HazardousWasteManagementDataVO data = frontEnterpriseService.getHazardousWasteManagementData();
        return ResultVO.ok(data);
    }

    /**
     * 8. 应急空间数据
     * 提供应急池和初雨池液位监控数据
     */
    @GetMapping("/emergency-space")
    @Operation(summary = "获取应急空间数据")
    public ResultVO<EmergencySpaceDataVO> getEmergencySpaceData() {
        EmergencySpaceDataVO data = frontEnterpriseService.getEmergencySpaceData();
        return ResultVO.ok(data);
    }

    /**
     * 9. 园区企业信息数据
     * 提供企业基本信息和地图展示数据
     */
    @GetMapping("/park-enterprise-info")
    @Operation(summary = "获取园区企业信息数据")
    public ResultVO<ParkEnterpriseInfoDataVO> getParkEnterpriseInfoData() {
        ParkEnterpriseInfoDataVO data = frontEnterpriseService.getParkEnterpriseInfoData();
        return ResultVO.ok(data);
    }

    /**
     * 10. 废气处理设施水质检测列表
     * 提供废气处理设施的水质检测数据列表，同一设备有多个检测因子时合并为一条记录
     */
    @GetMapping("/waste-gas-monitoring-list")
    @Operation(summary = "获取废气处理设施水质检测列表")
    public ResultVO<WasteGasMonitoringListVO> getWasteGasMonitoringList(@RequestParam(value = "companyId",required = false) String companyId) {
        WasteGasMonitoringListVO data = frontEnterpriseService.getWasteGasMonitoringList(companyId);
        return ResultVO.ok(data);
    }

    /**
     * 11. 雨排口折线图数据
     * 提供雨排口的PH值和电导率趋势数据，以及闸阀状态信息
     */
    @GetMapping("/rainfall-outlet-chart")
    @Operation(summary = "获取雨排口折线图数据")
    public ResultVO<RainfallOutletChartVO> getRainfallOutletChart(@RequestParam(value = "companyId",required = false) String companyId) {
        RainfallOutletChartVO data = frontEnterpriseService.getRainfallOutletChart(companyId);
        return ResultVO.ok(data);
    }

    /**
     * 12. 企业废水折线图数据
     * 提供分质分流废水的污染物浓度趋势数据，包括六价铬、总镍、总铬等指标
     */
    @GetMapping("/enterprise-wastewater-chart")
    @Operation(summary = "获取企业废水折线图数据")
    public ResultVO<EnterpriseWastewaterChartVO> getEnterpriseWastewaterChart(@RequestParam(value = "waterType",required = false)String waterType,
                                                                              @RequestParam(value = "companyId",required = false)String companyId) {
        EnterpriseWastewaterChartVO data = frontEnterpriseService.getEnterpriseWastewaterChart(waterType,companyId);
        return ResultVO.ok(data);
    }

    /**
     * 12. 企业废水折线图数据
     * 提供分质分流废水的污染物浓度趋势数据，包括六价铬、总镍、总铬等指标
     */
    @GetMapping("/enterprise-wastewater-type")
    @Operation(summary = "获取企业废水类型")
    public ResultVO<List<SewageWarningVO>> getEnterpriseWastewaterType(@RequestParam("companyId")String companyId) {
        List<SewageWarningVO> data = frontEnterpriseService.getEnterpriseWastewaterType(companyId);
        return ResultVO.ok(data);
    }

    /**
     * 13. 预排口废水折线图数据
     * 提供预排口废水的污染物浓度趋势数据，包括含铬沉淀出水、含镍沉淀出水、综合沉淀出水等类型
     */
    @GetMapping("/pre-discharge-wastewater-chart")
    @Operation(summary = "获取预排口废水折线图数据")
    public ResultVO<PreDischargeWastewaterChartVO> getPreDischargeWastewaterChart(@RequestParam(value = "waterType",required = false) String waterType) {
        PreDischargeWastewaterChartVO data = frontEnterpriseService.getPreDischargeWastewaterChart(waterType);
        return ResultVO.ok(data);
    }


}
